package com.ljx.qqpro.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.ljx.qqpro.entity.ChatNoticeEntity;
import com.ljx.qqpro.service.ChatNoticeService;
import com.ljx.qqpro.common.utils.PageUtil;
import com.ljx.qqpro.common.utils.Result;



/**
 * 聊天公告表
 *
 * @author LiJunXi
 * @email 2770063826@qq.com
 * @date 2023-10-18 17:28:14
 */
@RestController
@RequestMapping("qqpro/chatnotice")
public class ChatNoticeController {
    @Autowired
    private ChatNoticeService chatNoticeService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public Result list(@RequestParam Map<String, Object> params){
        PageUtil page = chatNoticeService.queryPage(params);

        return Result.success(page, "page");
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public Result info(@PathVariable("id") Long id){
		ChatNoticeEntity chatNotice = chatNoticeService.getById(id);

        return Result.success(chatNotice, "chatNotice");
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public Result save(@RequestBody ChatNoticeEntity chatNotice){
		chatNoticeService.save(chatNotice);

        return Result.success(null, "");
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public Result update(@RequestBody ChatNoticeEntity chatNotice){
		chatNoticeService.updateById(chatNotice);

        return Result.success(null, "");
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public Result delete(@RequestBody Long[] ids){
		chatNoticeService.removeByIds(Arrays.asList(ids));

        return Result.success(null, "");
    }

}
